|
|
"Ace" <ble### [at] icefognet> wrote in message
news:3c1f4f2c@news.povray.org...
> Hello,
>
> OK, I have a wheel that I need to turn on an axel, while the axel, wheel
and
> the whole car move. can I make the axel the center of the wheel some how?
> so that I can rotate it 360+ degrees while it moves?
If all your asking is for the way a typical vehicle rolls along on wheels
attached to a axle then yes, pretty simple to do.
You want the circumference of the wheel to match distance on the ground
plane.
(Radius*2)*pi=Distance
Radius being POV units of the wheel, Distance being the movement of the
whole car. So all you really are doing is finding that distance of travel
via the wheel size. So when you put translate Distance*clock*x into the Car
object statement you get that amount of travel.
Then for multiple turns of the wheel you simply add a extra variable for how
many times to turn it. Complete setup as follows:
light_source {
0,1.5
translate <-20, 20, -20>
}
plane {y,0 pigment {gradient x}}
#declare Number=2*clock; // number of wheel turns, animated
#declare Turns=360*Number; // convert to degrees
#declare Major=0.75; // the wheel size
#declare Minor=0.25; // the tire size
#declare Radius=Major+Minor; // these total Radius
#declare Distance=Number*(Radius*2)*pi; // amount of travel
#declare Tire=
torus {Major,Minor // 1 unit radius
pigment {leopard
color_map {
[0.5 rgb 0][0.5 rgb 1]
} scale 0.1
}
rotate 90*x // orient for y plane ground
}
#declare Wheel=
union {
object {Tire}
disc {0,z,Major,Minor
pigment {rgb <0,1,1>}
translate -0.125*z
}
}
#declare Axle=
cylinder {-z,z,0.125
pigment {rgb <1,1,1>}
}
#declare Body=
box {-1,1
pigment {rgb <1,1,0>}
scale <4,1,1.5>
}
#declare Car=
union {
object {Wheel
rotate -Turns*z
translate <-2.5,1,-1.5>}
object {Axle
scale <1,1,1.75>
translate <-2.5,1,0>}
object {Body
translate <0,1.5,0>}
translate Distance*x // move across screen to +x
}
object {Car}
camera {
location <0, 2, -10>
look_at <Distance, 1, 0>
right x*image_width/image_height
}
You'll need to put it all together as wanting, texturing and objects. I
might have gone too far writing up a whole scene here :-) without knowing
for certain your question. It sounded like you either had trouble with
origin rotations or motion along direction of movement. Hopefully this will
answer both things.
Post a reply to this message
|
|